﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net.Http;

namespace TPLOAWebClient
{
    public partial class studentdeleteloa : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void yesBtn_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {

                HttpClient client = (HttpClient)Session["httpclient"];
                string loaid = Request.QueryString["loa"];

                HttpResponseMessage response = client.DeleteAsync("api/LOAs/" + loaid).Result;
                if (response.IsSuccessStatusCode)
                {
                    Response.Redirect("studentviewloa.aspx?status=success&LOAID=" + loaid);
                }
                else
                {
                    Response.Redirect("studentviewloa.aspx?status=error&LOAID=" + loaid);
                }
            }
        }

        protected void noBtn_Click(object sender, EventArgs e)
        {
            Response.Redirect("studentviewloa.aspx");
        }
    }
}